// ---------组织架构----------
export function orgManageColumns() {
  return [
    {
      type: "selection",
      width: 60,
      align: "left"
    },
    {
      title: this.$t("module.orgManage.orgName"),
      key: "orgTreeName",
      align: "left",
      render: (h, params) => {
        return h(
          "span",
          {
            attrs: {
              title: params.row.orgTreeName
            }
          },
          params.row.orgTreeName
        );
      }
    },
    {
      title: this.$t("module.orgManage.orgCode"),
      align: "left",
      key: "orgTreeCode",
      render: (h, params) => {
        return h(
          "span",
          {
            attrs: {
              title: params.row.orgTreeCode
            }
          },
          params.row.orgTreeCode
        );
      }
    },
    {
      title: this.$t("module.orgManage.orgType"),
      align: "left",
      key: "orgDimensionCode",
      render: (h, params) => {
        return h("span", this.orgDimensionDic[params.row.orgDimensionCode]);
      }
    },
    {
      title: this.$t("module.orgManage.orgDesc"),
      key: "orgTreeDesc",
      render: (h, params) => {
        return h(
          "span",
          {
            attrs: {
              title: params.row.orgTreeDesc
            }
          },
          params.row.orgTreeDesc
        );
      }
    },
    {
      title: this.$t("common.operating"),
      align: "left",
      fixed: "right",
      width: 80,
      render: (h, params) => {
        return h("RowTools", {
          props: {
            data: [
              {
                type: "icon",
                icon: "md-create",
                text: this.$t("common.edit"),
                handle: () => {
                  this.openDialog({ orgInfo: params.row });
                }
              },
              {
                type: "icon",
                icon: "md-add",
                text: this.$t("module.orgManage.addChildOrg"),
                handle: () => this.addChilden(params)
              }
            ]
          }
        });
      }
    }
  ];
}
// ---------公司信息----------
export function companyInfoColumns() {
  const COLUMN_WIDTH = window.RPConfig.COLUMN_WIDTH
  return [
    {
      title: this.$t("module.orgManage.companyCode"),
      key: "companyCode",
      align: "left",
      sortable: "custom"
      // render: (h, params) => {
      //   return h(
      //     "span",
      //     {
      //       attrs: {
      //         title: params.row.companyCode
      //       }
      //     },
      //     params.row.companyCode
      //   );
      // }
    },
    {
      title: this.$t("module.orgManage.companyName"),
      align: "left",
      key: "companyName",
      sortable: "custom"
      // render: (h, params) => {
      //   return h(
      //     "span",
      //     {
      //       attrs: {
      //         title: params.row.companyName
      //       }
      //     },
      //     params.row.companyName
      //   );
      // }
    },
    {
      title: this.$t("module.orgManage.companyShort"),
      align: "left",
      key: "companyShortName"
    },
    {
      title: this.$t("module.orgManage.orgOrganCode"),
      key: "companyOrgCode",
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_8_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_8_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,

      // render: (h, params) => {
      //   return h(
      //     "span",
      //     {
      //       attrs: {
      //         title: params.row.companyOrgCode
      //       }
      //     },
      //     params.row.companyOrgCode
      //   );
      // }
    },
    {
      title: this.$t("common.status"),
      key: "enabled",
      align: "center",
      minWidth: 80,
      maxWidth: 80 + COLUMN_WIDTH.MAX_WIDTH_MORE,

      render: (h, params) => {
        return h(
          "StatusButton",
          {
            // 修改StatusButton内容居中
            style: {
              "justify-content": "center"
            },

            props: {
              status: params.row.enabled == 1 ? "0" : "1"
            }
          },
          params.row.enabled == 1 ? this.$t("common.enable") : this.$t("common.disable")
        );
      }
    },
    {
      title: this.$t("common.operating"),
      align: "left",
      fixed: "right",
      width: 80,
      render: (h, params) => {
        return h("RowTools", {
          props: {
            data: [
              {
                type: "icon",
                icon: "md-create",
                text: this.$t("common.edit"),
                handle: () => {
                  this.openDialog(params.row);
                  // this.openDialog({ companyInfo: params.row });
                }
              }
            ]
          }
        });
      }
    }
  ];
}
